Sanjan
11/24/2025, 5:24 AMInvalidAuthentication (401) Request failed with status code: 401 Unauthorized,
{"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"},"request_id":"req_011CVS9mZX2HWyWvLd2FDx4D"}
Request options: {"model":"claude-sonnet-4-5-20250929","max_tokens":4096}
Here is my BAML client
// Coding agent for modifying React Native App.js files
// Output structure for the coding agent
class CodeGenerationResult {
code string
}
// Client for Claude Sonnet 3.5
client<llm> ClaudeSonnet {
provider anthropic
options {
model "claude-sonnet-4-5-20250929"
api_key env.ANTHROPIC_API_KEY
}
}
// Function to generate/modify App.js code based on user prompt
function GenerateAppJsCode(
userPrompt: string,
currentAppJs: string
) -> CodeGenerationResult {
client ClaudeSonnet
prompt #"
You are a React Native/Expo coding assistant. Your task is to modify the App.js file in a React Native Expo application based on user requirements.
Current App.js code:
```javascript
{{ currentAppJs }}
User requirements:
{{ userPrompt }}
Please provide the complete updated App.js code in the required JSON format:
"#
}
test create_simple_app {
functions [GenerateAppJsCode]
args {
userPrompt "Create a simple React Native app with a button that says 'Hello World'"
currentAppJs #"
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View } from 'react-native';
export default function App() {
return (
Open up App.js to start working on your app!
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
"#
}
}
```Sanjan
11/24/2025, 5:26 AM